﻿<ResourceDictionary x:Class="Outcoder.Calcium.DiagramDesigner.DesignerDictionary"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Module="clr-namespace:Outcoder.Calcium.DiagramDesigner">

	<ControlTemplate x:Key="DragThumbTemplate"  TargetType="{x:Type Module:DesignerThumb}">
		<Rectangle Fill="Transparent"/>
	</ControlTemplate>

	<Style x:Key="DesignerItemStyle" TargetType="{x:Type Module:DesignerHost}">
		<Setter Property="MinHeight" Value="60"/>
		<Setter Property="MinWidth" Value="60"/>
		<Setter Property="SnapsToDevicePixels" Value="true"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="ContentControl">
					<Grid DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}">
						<ContentPresenter Content="{TemplateBinding ContentControl.Content}"
                              Margin="{TemplateBinding Padding}"/>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<DataTemplate x:Key="DesignerItemView">
		<StackPanel>		
			<Grid>	
				<Rectangle  Width="100" Height="100" />		
				<Viewport3D>
					<Viewport3D.Camera>
						<PerspectiveCamera Position="2.9,2.65,2.9" LookDirection="-1,-1,-1"/>
					</Viewport3D.Camera>
					<Viewport3D.Children>
						<ModelVisual3D x:Name="Light">
							<ModelVisual3D.Content>
								<DirectionalLight Direction="-0.3,-0.4,-0.5"/>
							</ModelVisual3D.Content>
						</ModelVisual3D>
						<ModelVisual3D x:Name="Cube">
							<ModelVisual3D.Transform>
								<RotateTransform3D>
									<RotateTransform3D.Rotation>
										<AxisAngleRotation3D x:Name="RotateY" Axis="0,1,0" Angle="0"/>
									</RotateTransform3D.Rotation>
								</RotateTransform3D>
							</ModelVisual3D.Transform>
						<ModelVisual3D.Content>
						<GeometryModel3D>
							<GeometryModel3D.Material>
								<DiffuseMaterial>
									<DiffuseMaterial.Brush>
										<VisualBrush Stretch="Fill" Transform="1,0,0,-1,0,1">
											<VisualBrush.Visual> 
												<Grid Background="#FF8E8E8E">
													<Label Content="Calcium"
															Foreground="White"
															FontSize="9"
															Margin="5,5,5,5"
															HorizontalContentAlignment="Center"
															VerticalAlignment="Center"/>
												</Grid>
											</VisualBrush.Visual>
										</VisualBrush>
									</DiffuseMaterial.Brush>
								</DiffuseMaterial>
							</GeometryModel3D.Material>
							<GeometryModel3D.Geometry>
								<MeshGeometry3D Positions="1,1,-1 1,-1,-1 -1,-1,-1 -1,1,-1 1,1,1 -1,1,1 -1,-1,1 1,-1,1 1,1,-1 1,1,1 1,-1,1 1,-1,-1 1,-1,-1 1,-1,1 -1,-1,1 -1,-1,-1 -1,-1,-1 -1,-1,1 -1,1,1 -1,1,-1 1,1,1 1,1,-1 -1,1,-1 -1,1,1"
												TriangleIndices="0 1 2 0 2 3 4 5 6 4 6 7 8 9 10 8 10 11 12 13 14 12 14 15 16 17 18 16 18 19 20 21 22 20 22 23" 
												TextureCoordinates="0,1 0,0 1,0 1,1 1,1 0,1 0,-0 1,0 1,1 0,1 0,-0 1,0 1,0 1,1 0,1 0,-0 0,0 1,-0 1,1 0,1 1,-0 1,1 0,1 0,0"/>
							</GeometryModel3D.Geometry>
							<GeometryModel3D.Transform>
			                    <RotateTransform3D>
			                      <RotateTransform3D.Rotation>
			                        <AxisAngleRotation3D x:Name="angleRotation" Axis="0,1,0" Angle="0" />
			                      </RotateTransform3D.Rotation>
			                    </RotateTransform3D>
			                  </GeometryModel3D.Transform>
						</GeometryModel3D>
					</ModelVisual3D.Content>
				</ModelVisual3D>
			</Viewport3D.Children>
			<Viewport3D.Triggers>
		            <EventTrigger RoutedEvent="Viewport3D.Loaded">
		              <BeginStoryboard>
		                <Storyboard>					
		                  <DoubleAnimation 
		                   		Storyboard.TargetName="RotateY" 
		                  	 	Storyboard.TargetProperty="Angle" 
		                   		From="0" To="360" Duration="0:0:10" AutoReverse="False"  RepeatBehavior="Forever"/>
		                </Storyboard>
		              </BeginStoryboard>
		            </EventTrigger>
	          </Viewport3D.Triggers>
		</Viewport3D>
								
			</Grid>
			
<!--			<StackPanel Orientation="Horizontal" IsHitTestVisible="False">
				<TextBlock Text="{Binding Left}" IsHitTestVisible="False"/>
				<TextBlock Text=", " IsHitTestVisible="False"/>
				<TextBlock Text="{Binding Top}" IsHitTestVisible="False"/>
				
			</StackPanel>-->
		</StackPanel>
	</DataTemplate>

	<!-- DragThumb Default Template -->
	<Style TargetType="{x:Type Module:DesignerThumb}">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Module:DesignerThumb}">
					<Rectangle Fill="Transparent"/>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<!-- DesignerItemView Style -->
	<Style TargetType="{x:Type Module:DesignerHost}">
		<Setter Property="MinWidth" Value="10"/>
		<Setter Property="MinHeight" Value="10"/>
		<Setter Property="SnapsToDevicePixels" Value="True"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Module:DesignerHost}">
					<Grid DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}">
						<Rectangle 
							Width="{TemplateBinding ContentControl.Width}" 
							Height="{TemplateBinding ContentControl.Height}"
							Margin="-10" Fill="Transparent"  />
						
						<!-- PART_ContentPresenter -->
						<ContentPresenter x:Name="PART_ContentPresenter" 
                                          HorizontalAlignment="Center"
                                          VerticalAlignment="Center"
                                          Content="{TemplateBinding ContentControl.Content}"
                                          Margin="{TemplateBinding ContentControl.Padding}" />

						<!-- PART_DesignerThumb -->
						<Module:DesignerThumb x:Name="PART_DragThumb" 
                                     Cursor="SizeAll"/>

					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</ResourceDictionary>
